import win32com.client
# o = win32com.client.Dispatch("Excel.Application")#{00024500-0000-0000-C000-000000000046}
o = win32com.client.Dispatch("{00024500-0000-0000-C000-000000000046}")#{00024500-0000-0000-C000-000000000046}
o.Visible = 1
o.Workbooks.Add() # 
# o.Cells(1,1).Value = "Hello"
# o.DisplayAlerts=False
# range=o.ActiveSheet.
# Range = WorkSheet.querySubObject("Range(QString)", "A1:C2");  # A1:C2的范围
# Range.setProperty("Value", "hello");
# values = Range.property("Value");
# print(values)
# tempVarList = values.value<QVariantList>();
# # 读取Range的数据
# for (int i = 0; i < tempVarList.size(); ++i) {
# QVariantList tempVarRow = tempVarList [i].value<QVariantList>();
# for(int j=0; j < tempVarRow .size(); ++j)
#   cout<<tempVarRow[j].toString();
# }


# int rows = 200000;
# int cols = 10;
# cout << rows << cols;

# QElapsedTimer timer;
# timer.start ();
# QVariantList mList;   # 写入Range的数据
# for (int i = 0; i < rows; ++i) {
# QVariantList tempVarRow;
# for (int j = 0; j < cols; ++j) {
#   tempVarRow << i*cols + j + 1;
# #      cout << i << j;
# }
# mList.append (QVariant(tempVarRow));
# }

# #  cout << mList;

# Range = WorkSheet.querySubObject ("Range(QString)","A1");
# Range = Range.querySubObject("Resize(int,int)", rows,cols);

# Range.setProperty ("Value",mList);
# #是否可视化excel
# Application.setProperty("Visible", true);

# cout << timer.elapsed ();
# #  release();
# return 0;

